package com.example.quiz.dao;

import com.example.quiz.model.AnswerRecord;
import org.apache.ibatis.annotations.Param;
import java.util.List;

public interface AnswerRecordMapper {
    int insert(AnswerRecord record);

    List<AnswerRecord> selectByUserId(@Param("userId") Long userId);

    List<AnswerRecord> selectByQuestionId(@Param("questionId") Long questionId);

    int deleteById(Long id);

    AnswerRecord selectById(Long id);

    List<AnswerRecord> selectAll();

    List<AnswerRecord> selectByUserAndQuestion(Long userId, Long questionId);

    int selectTotalCount(Long userId);

    int selectCorrectCount(Long userId);

    List<AnswerRecord> selectPagedRecords(@Param("offset") int offset, @Param("size") int size,
            @Param("userId") Long userId);

    int update(AnswerRecord entity);

    int deleteByQuestionId(@Param("questionId") Long questionId);
}
